// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import  './plugins/Vant'
import 'vant/lib/index.css'
import 'amfe-flexible'
import axios from 'axios'
import qs from 'qs'
import Meta from "vue-meta";
Vue.use(Meta);

// axios.defaults.baseURL = '/api'
Vue.prototype.$http=axios
Vue.prototype.$qs = qs

Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
  if(to.meta.content){
    let head = document.getElementsByTagName('head');
    let meta = document.createElement('meta');
    meta.content = to.meta.content;
    head[0].appendChild(meta)
  }

  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

/* eslint-disable no-new */
new Vue({

  router,
  render: h=>h(App)
}).$mount('#app')
